package com.gmcc.docmanager.download;

import java.util.Map;

import org.apache.http.client.methods.HttpRequestBase;

import com.gmcc.docmanager.util.loader.DefaultMakeHttpHead;

public class DownloadHttpHead extends DefaultMakeHttpHead {
	private long startOffset;

	public DownloadHttpHead(long startOffset) {
		this.startOffset = startOffset;
	}

	@Override
	public void makeHttpHead(HttpRequestBase hr, boolean isgzip) {
		super.makeHttpHead(hr, false);
		hr.addHeader("Range", "bytes=" + startOffset + "-");
	}

	@Override
	public Map<String, String> getHeaders(boolean isgzip) {
		Map<String, String> headers = super.getHeaders(false);
		headers.put("Range", "bytes=" + startOffset + "-");
		return headers;
	}
}
